<template>
  <div>
    <address-head title="新增地址"></address-head>
    <div class="container">
      <van-address-edit
        :area-list="addressInfo"
        show-postal
        show-set-default
        :area-columns-placeholder="['请选择', '请选择', '请选择']"
        @save="onSave"
      />
    </div>
  </div>
</template>

<script>
import AddressHead from '@components/AddressHead'
import { mapState, mapMutations } from 'vuex'
export default {
  data () {
    return {
    }
  },
  computed: {
    ...mapState({
      addressInfo: (state) => state.address.addressInfo
    })
  },
  methods: {
    onSave (add) {
      add.id = Date.now()
      this.addConcact(add)
      this.$router.push('/addressList')
    },
    ...mapMutations('address', ['addConcact'])
  },
  components: {
    AddressHead
  }
}
</script>

<style lang="scss" scoped>

</style>
